///		VIOLENT CONFLICT AND HOSTILITY TOWARDS ETHNORELIGIOUS OUTGROUPS IN NIGERIA

//									Daniel Tuki

*The variable names and the question number in the survey instrument are specified in parenthesis. The survey instrument for the Round 7 Afrobarometer dataset for Nigeria can be accessed here: https://www.afrobarometer.org/



//				DEPENDENT VARIABLE
			
*Outgroup hostility (out_host)This combines two items from the survey on the willingness to have people from other religions and ethnic groups as neighbors (q87a and q87b): 
*To treat "Dont know" responses as missing for the two questions: 
replace q87a = . if q87a > 5
replace q87b = . if q87b > 5

*The responses are on a five-point ordinal scale such that, "1 = Strongly dislike" to "5 = Strongly like." For an easier interpretation of the regression results, I inverted the values assigned to the response categories by subtracting them from 6. This allows higher ordinal values to denote a higher level of outgroup hostiltiy and vice versa: 
gen out_rel = 6 - q87a
gen out_eth = 6 - q87b
*The former variable measures hostility towards religious outgroups only, while the latter measures hostility towards ethnic outgroups only. 

*To create an additive indicator that captures both ethnic and religious outgroup hostility: 
gen out_host = out_rel + out_eth 

*To check the internal reliability of these two combined items (Cronbach's alpha 0.84): 
alpha out_rel out_eth 

*To check the correlation between the two items (r = 0.72): 
corr out_rel out_eth 

*The final additive indicator for outgroup hostility ranges from 2 to 10, with higher values denoting a higher level of outgroup hostility and vice versa. 



//				EXPLANATORY VARIABLE
			
*Violent conflict (vio_incids_30km): This measures the total number of violent conflict incidents within the 30km buffer around the responents' dwelling. I also developed this variable for the 20km and 40km buffers. These can be used to conduct robustness checks by modifying the relevant codes acordingly. Based on the ACLED data, I define a violent conflict as any incident that falls under any of the following three categories: "Violence against civilians", "Battles", and "Explosions/Remote violence."



//				CONTROL VARIABLES
			
*Educational attainment (educ) (q97)
gen educate = q97
*To treat "Don't know" responses as missing:
replace educate = . if q97 > 9			


*Household deprivation (deprivation)
*(Based on q8a q8b q8c q8d q8e)

*Food (food)
gen food = q8a
**To treat "Don't know" responses as missing (same for other factors)
replace food = . if food > 4
*Measures the frequency with which the household has gone without food

*Water (water)
gen water = q8b
replace water = . if water > 4
*Measures the frequency with which the household has gone without water for use at home. 

*Medicine (medicine)
gen medicine = q8c
replace medicine = . if medicine > 4
*Measures the frequency with which the household has gone without medicine when sick

*Fuel (fuel)
gen fuel = q8d
replace fuel = . if fuel > 4
*Measures the frequency with which the household has gone without fuel to cook food.

*Income (income)
gen income = q8e
replace income = . if income > 4
*Measures the frequency with which the household has gone without income.

*To sum the five items:  
gen deprivation = food + water + medicine + fuel + income

*To check the internal reliability of these 5 items (Cronbbach Alpha 0.81): 
alpha food water medicine fuel income
						
							
*Gender (gender) (q101):This takes the value of 1 if the respondent is male, and 0 if female (q101): 
gen gender = q101
*To code female which was coded as "2" as "0"
replace gender = 0 if q101 == 2
*Male is already coded as 1 in the variable "q101"


*Age (age) (q1): This measures the age of the respondent. 
gen age = q1
*To treat the "don't know" responses as missing "i.e. value of 998"
replace age = . if age == 998


*Ethnic group (ethnic) (q84): This specifies the ethnic group to which the repsondent belongs. 
*I use this as a factor variable for all the ethnic groups - i.e., fixed effects (q84). 
gen ethnic_grp = q84 


*Religious afiliation (religion) (q98): This is a dummy variable that takes the value of 0 if the respondent is "Muslim" and 1 if "Christian". Since my focus is on the two main religious groups, I treat the respondents who belong to neither of these religions as missing observations (eg. jewish, agnostics, Buddhists, none  [n = 20]). This leads to a marginal decrease in the number of observations. 

*To develop a dummy variable for reliugious affiliation, I collapse all the Christian denominations into a single category, and do same for all the Muslim denominations (See q98 in survey questionnaire for the religious categories). 

gen religion = .

*To code all the Christian sects as "1": 
replace religion = 1 if q98 == 1
replace religion = 1 if q98 == 2
replace religion = 1 if q98 == 3
replace religion = 1 if q98 == 4
replace religion = 1 if q98 == 5
replace religion = 1 if q98 == 6
replace religion = 1 if q98 == 7
replace religion = 1 if q98 == 8
replace religion = 1 if q98 == 9
replace religion = 1 if q98 == 10
replace religion = 1 if q98 == 11
replace religion = 1 if q98 == 12
replace religion = 1 if q98 == 13
replace religion = 1 if q98 == 14
replace religion = 1 if q98 == 15
replace religion = 1 if q98 == 16
replace religion = 1 if q98 == 17
replace religion = 1 if q98 == 30
replace religion = 1 if q98 == 31
replace religion = 1 if q98 == 32
replace religion = 1 if q98 == 33

*To code all Muslim sects as "0": 
replace religion = 0 if q98 == 18
replace religion = 0 if q98 == 19
replace religion = 0 if q98 == 20
replace religion = 0 if q98 == 21
replace religion = 0 if q98 == 22
replace religion = 0 if q98 == 23
replace religion = 0 if q98 == 24
replace religion = 0 if q98 == 620
			

**I have discussed the objective control variables (i.e., Population size, prevalence of stunting, and Nighttime light) in the main paper. I have also done same for the instrumental variable - i.e. forest cover. Because these variables are based on gridded data, I developed the relevant statistics for the buffers using QGIS software. 
	
	
	
//					INSTRUMENTAL VARIABLES

*Forest Cover (forest_ratio_globcover_km): This measures the ratio of the land area within the buffer around the respondents' dwellings classified as forests. I computed this variable for the 20, 30, and 40km buffers. 

*(Forest cover)^2: This measures the square of the forst cover variable. I also developed this variable for the 20, 30, & 40km buffers: 

gen forest_ratio_globcover_30km_sq = (forest_ratio_globcover_30km)^2



//					DESCRIPTIVE VARIABLE

*In the text, I referred to a question where respondents were asked about the degree to which Muslims support extremist groups. (q81f):
gen ext_muslim = q81f

tab ext_muslim

*For the Christian subsample
tab ext_muslim if religion == 1

*For the Muslim subsample
tab ext_muslim if religion == 0
			
		
			
			
//						REGRESSION RESULTS***
			
// 			1st-stage regressions
			
// Table 1: Association between forest cover and violent conflict  

*All models are estimated using OLS regression

*Model 1: (Using the full sample for Nigeria)
regress vio_incids_30km forest_ratio_globcover_30km

*Model 2: (Using Northern Nigeria subsample) 
regress vio_incids_30km forest_ratio_globcover_30km if south == 0

*Model 3: (Using Southern Nigeria subsample)
regress vio_incids_30km forest_ratio_globcover_30km if south == 1

*Model 4: (Testing for an inverse quadratic relationship - using the square of forest cover - Full sample)
regress vio_incids_30km forest_ratio_globcover_30km_sq

*Model 5: (Including both forest cover and its square in the model - Full sample)
regress vio_incids_30km forest_ratio_globcover_30km forest_ratio_globcover_30km_sq



// 							2nd-stage IV regressions 	

// Table 2: Effect of violent conflict on outgroup hostility I (Full sample & religious subsamples)
		
**Model 1: IV Baseline - Full sample
ivregress 2sls out_host i.ethnic_grp (vio_incids_30km = forest_ratio_globcover_30km forest_ratio_globcover_30km_sq)
*To conduct the test for endogeneity & overidentifying restrictions: 
estat endog
estat overid

*Model 2: IV with control variables - Full sample
ivregress 2sls out_host night_light_2016_30km stunt_both_30km deprivation log_total_pop_30km educate religion gender age i.ethnic_grp (vio_incids_30km = forest_ratio_globcover_30km forest_ratio_globcover_30km_sq)
*To conduct the test for endogeneity & overidentifying restrictions: 
estat endog
estat overid
					
*To check for heterogeneity in the religious subsamples

* Model 3: IV - Christian subsample
ivregress 2sls out_host night_light_2016_30km stunt_both_30km deprivation log_total_pop_30km educate gender age i.ethnic_grp (vio_incids_30km = forest_ratio_globcover_30km forest_ratio_globcover_30km_sq) if religion == 1
*To conduct the test for endogeneity & overidentifying restrictions: 
estat endog
estat overid		

* Model 4: IV - Muslim subsamples
ivregress 2sls out_host night_light_2016_30km stunt_both_30km deprivation log_total_pop_30km educate gender age i.ethnic_grp (vio_incids_30km = forest_ratio_globcover_30km forest_ratio_globcover_30km_sq) if religion == 0 
*To conduct the test for endogeneity & overidentifying restrictions: 
estat endog
estat overid


*Model 5: OLS using the Muslim subsample
regress out_host vio_incids_30km night_light_2016_30km stunt_both_30km deprivation log_total_pop_30km educate gender age i.ethnic_grp, vce(robust), if religion == 0 



	
// Table 3: Effect of violent conflict on outgroup hostility II (Full sample only)

*Religious outgroup hostility (Models 1 & 2)

*Model 1: IV baseline
ivregress 2sls out_rel i.ethnic_grp (vio_incids_30km = forest_ratio_globcover_30km forest_ratio_globcover_30km_sq)
*To conduct the test for endogeneity & overidentifying restrictions: 
estat endog
estat overid

*Model 2: IV with control variables
ivregress 2sls out_rel night_light_2016_30km stunt_both_30km deprivation log_total_pop_30km educate religion gender age i.ethnic_grp (vio_incids_30km = forest_ratio_globcover_30km forest_ratio_globcover_30km_sq)
*To conduct the test for endogeneity & overidentifying restrictions: 
estat endog
estat overid

*Ethnic outgroup hostility (Models 3 & 4)

*Model 3: IV baseline
ivregress 2sls out_eth i.ethnic_grp (vio_incids_30km = forest_ratio_globcover_30km forest_ratio_globcover_30km_sq)
*To conduct the test for endogeneity & overidentifying restrictions: 
estat endog
estat overid

*Model 4: IV with control variables
ivregress 2sls out_eth night_light_2016_30km stunt_both_30km deprivation log_total_pop_30km educate religion gender age i.ethnic_grp (vio_incids_30km = forest_ratio_globcover_30km forest_ratio_globcover_30km_sq)
*To conduct the test for endogeneity & overidentifying restrictions: 
estat endog
estat overid




// Table 4: Effect of violent conflict on outgroup hostility III (Religious subsamples only)
	
*	Hostility towards religious outgroups only

*Model 1:  IV - Christians
ivregress 2sls out_rel night_light_2016_30km stunt_both_30km deprivation log_total_pop_30km educate gender age i.ethnic_grp (vio_incids_30km = forest_ratio_globcover_30km forest_ratio_globcover_30km_sq) if religion == 1
*To conduct the test for endogeneity & overidentifying restrictions: 
estat endog
estat overid

*Model 2:  IV - Muslims
ivregress 2sls out_rel night_light_2016_30km stunt_both_30km deprivation log_total_pop_30km educate gender age i.ethnic_grp (vio_incids_30km = forest_ratio_globcover_30km forest_ratio_globcover_30km_sq) if religion == 0	
*To conduct the test for endogeneity & overidentifying restrictions: 
estat endog
estat overid

*Model 3:  OLS - Muslims
regress out_rel vio_incids_30km night_light_2016_30km stunt_both_30km deprivation log_total_pop_30km educate gender age i.ethnic_grp if religion == 0 

*	Hostility towards religious outgroups only

*Model 4: IV - Christians
ivregress 2sls out_eth night_light_2016_30km stunt_both_30km deprivation log_total_pop_30km educate gender age i.ethnic_grp (vio_incids_30km = forest_ratio_globcover_30km forest_ratio_globcover_30km_sq) if religion == 1
*To conduct the test for endogeneity & overidentifying restrictions: 
estat endog
estat overid

*Model 5: IV - Muslims
ivregress 2sls out_eth night_light_2016_30km stunt_both_30km deprivation log_total_pop_30km educate gender age i.ethnic_grp (vio_incids_30km = forest_ratio_globcover_30km forest_ratio_globcover_30km_sq) if relig == 0 	
*To conduct the test for endogeneity & overidentifying restrictions: 
estat endog
estat overid

*Model 6: OLS - Muslims
regress out_eth vio_incids_30km night_light_2016_30km stunt_both_30km deprivation log_total_pop_30km educate gender age i.ethnic_grp if relig == 0 			
			
			

//						APPENDIX
					
*Table A1: Descriptive statistics			
summ out_host out_rel out_eth vio_incids_30km night_light_2016_30km stunt_both_30km deprivation log_total_pop_30km educate religion gender age forest_ratio_globcover_30km forest_ratio_globcover_30km_sq
		
		
*Table A2: Ethnic distribution of respondents  
tab ethnic_grp
*See q84 in the questionnaire for more details on the ethnic groups. 

*Table 3: Correlation between the variables
corr out_host out_rel out_eth vio_incids_30km night_light_2016_30km stunt_both_30km deprivation log_total_pop_30km educate religion gender age forest_ratio_globcover_30km forest_ratio_globcover_30km_sq

			
			
			***ADDITIONAL ROBUSTNESS CHECKS USING 20km & 50km Buffers***

*In the data file, I've provided the relevant variables measured using buffers with alternative radii of 20km and 40km. To replicate the results above results using a different buffer size, simply adjust the number in the variable names accordingly and run the codes. 







